<template>
  <div>
    <NavBar>
      <div slot="left" class="back" @click="backClick">
        <img src="~assets/img/common/back.svg" alt="">
      </div>
      <div slot="center" class="title">
        <span v-for="(item,index) in titles" class="title-item"
        :key="index" :class="{active:index===currentIndex}"
        @click="currentIndex=index"
        >{{item}}</span>
      </div>
    </NavBar>
  </div>
</template>

<script>
  import NavBar from 'components/common/navbar/NavBar.vue';
  export default {
    name: "DetailNavBar",
    components:{
      NavBar
    },
    data() {
      return {
        titles: ['商品','参数','评论','推荐'],
        currentIndex:0
      }
    },
    methods:{
      backClick(){
        this.$router.back();
      }
    }
  }
</script>

<style scoped>
.title-item{
  display: inline-block;
  margin: 0 5px;
}
.active{
  color: var(--color-high-text);
}
.back{
  margin-top:6px;
}
</style>